﻿Public Class AdminPanel

    Private Sub AdminPanel_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'Members1._members' table. You can move, or remove it, as needed.
        Me.MembersTableAdapter1.Fill(Me.Members1._members)
        'TODO: This line of code loads data into the 'Players._Players' table. You can move, or remove it, as needed.
        Me.PlayersTableAdapter.Fill(Me.Players._Players)
        'TODO: This line of code loads data into the 'DataSet4.Alliance_Stats' table. You can move, or remove it, as needed.
        Me.Alliance_StatsTableAdapter.Fill(Me.DataSet4.Alliance_Stats)
        'TODO: This line of code loads data into the 'Alliances._Alliances' table. You can move, or remove it, as needed.
        Me.AlliancesTableAdapter.Fill(Me.Alliances._Alliances)
        'TODO: This line of code loads data into the 'StoredProcedures.Get_StoredProcedures' table. You can move, or remove it, as needed.
        Me.Get_StoredProceduresTableAdapter.Fill(Me.StoredProcedures.Get_StoredProcedures)
        'TODO: This line of code loads data into the 'Commands._commands' table. You can move, or remove it, as needed.
        Me.CommandsTableAdapter.Fill(Me.Commands._commands)
        'TODO: This line of code loads data into the 'DataSet3.units' table. You can move, or remove it, as needed.
        Me.UnitsTableAdapter.Fill(Me.DataSet3.units)
        'TODO: This line of code loads data into the 'TravianRaces.races' table. You can move, or remove it, as needed.
        Me.RacesTableAdapter.Fill(Me.TravianRaces.races)
        'TODO: This line of code loads data into the 'DataSet2.priveleged_members' table. You can move, or remove it, as needed.
        Me.Priveleged_membersTableAdapter.Fill(Me.DataSet2.priveleged_members)
        'TODO: This line of code loads data into the 'DataSet1.members' table. You can move, or remove it, as needed.
        Me.MembersTableAdapter.Fill(Me.DataSet1.members)

    End Sub


    Dim ws As New ServiceReference1.GetDataSoapClient


    Private Sub btnCreateDB_Click(sender As System.Object, e As System.EventArgs) Handles btnCreateDB.Click
        Try
            ws.CreateDB()
            MsgBox("Travian aangemaakt !", MsgBoxStyle.Information, "Succes")
        Catch ex As Exception
            MsgBox("Er is een fout opgetreden :" & ex.ToString, MsgBoxStyle.Critical, "Fout")
        End Try

    End Sub

    Private Sub btnDBVullen_Click(sender As System.Object, e As System.EventArgs) Handles btnDBVullen.Click
        Try
            ws.PopulateDB()
            MsgBox("Travian aangevuld !", MsgBoxStyle.Information, "Succes")
        Catch ex As Exception
            MsgBox("Er is een fout opgetreden :" & ex.ToString, MsgBoxStyle.Critical, "Fout")
        End Try
    End Sub

    Private Sub btnMembersVullen_Click(sender As System.Object, e As System.EventArgs) Handles btnMembersVullen.Click
        Try
            If (txtUserAlliantie.Text <> String.Empty) Then
                ws.Populate_Members(txtUserAlliantie.Text)
                MsgBox("Travian aangevuld !", MsgBoxStyle.Information, "Succes")
            Else
                MsgBox("Vul je Alliantie in !", MsgBoxStyle.Information, "Fout")
            End If
        Catch ex As Exception
            MsgBox("Er is een fout opgetreden :" & ex.ToString, MsgBoxStyle.Critical, "Fout")
        End Try
    End Sub

    Private Sub btnRefresh_Click(sender As System.Object, e As System.EventArgs) Handles btnRefresh.Click
        Me.DataGridView1.Refresh()
        Me.DataGridView2.Refresh()
    End Sub
End Class